package com.dragonlance.net;

import java.nio.charset.Charset;

import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.codec.ProtocolEncoderAdapter;
import org.apache.mina.filter.codec.ProtocolEncoderOutput;

public class DLProtocalEncoder extends ProtocolEncoderAdapter {
	private final Charset charset;

	public DLProtocalEncoder(Charset charset) {
		this.charset = charset;
	}

	// 在此处实现包的编码工作，并把它写入输出流中
	public void encode(IoSession session, Object message, ProtocolEncoderOutput out) throws Exception {
		PackageOut value = (PackageOut) message;
		value.pack();
		out.write(value.getBuff());
	}
}

